package com.ssy.lingxi.order.controller.web;

import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.dataauth.annotation.order.BuyerAuth;
import com.ssy.lingxi.order.model.vo.basic.request.*;
import com.ssy.lingxi.order.model.vo.basic.response.*;
import com.ssy.lingxi.order.model.vo.buyer.request.*;
import com.ssy.lingxi.order.model.vo.buyer.response.*;
import com.ssy.lingxi.order.service.web.IBuyerOrderService;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.math.BigDecimal;
import java.util.List;

/**
 * @menu 订单能力 - 采购订单相关接口
 * @author 万宁
 * @version 2.0.0
 * @date 2021-07-19
 */
@RestController
@RequestMapping("/order/buyer")
public class BuyerOrderController {
    @Resource
    private IBuyerOrderService buyerOrderService;

    /**
     * “待分配订单” - 获取前端页面下拉框列表
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/take/page/items", method = RequestMethod.GET)
    public Wrapper<List<DropdownItem>> getTakePageItems(@RequestHeader HttpHeaders headers) {
        return buyerOrderService.getTakePageItems(headers);
    }

    /**
     * “待分配订单” - 查询订单列表
     * @param headers  Http头部信息
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/take/page", method = RequestMethod.GET)
    public Wrapper<PageData<BaseBuyerOrderQueryVO>> pageToTakeOrders(@RequestHeader HttpHeaders headers, @Valid OrderPageVO pageVO) {
        return buyerOrderService.pageToTakeOrders(headers, pageVO);
    }

    /**
     * “待分配订单” - 订单详情
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/take/detail", method = RequestMethod.GET)
    public Wrapper<BuyerOrderDetailVO> getToTakeOrderDetail(@RequestHeader HttpHeaders headers, @Valid OrderIdVO idVO) {
        return buyerOrderService.getToTakeOrderDetail(headers, idVO);
    }

    /**
     * “待分配订单” - 领取订单
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 操作结果
     */
    @RequestMapping(value = "/take", method = RequestMethod.POST)
    public Wrapper<Void> takeOrder(@RequestHeader HttpHeaders headers, @RequestBody @Valid OrderIdVO idVO) {
        return buyerOrderService.takeOrder(headers, idVO);
    }

    /**
     * “待分配订单” - 批量领取订单
     * @param headers Http头部信息
     * @param orderIds 订单Id列表
     * @return 操作结果
     */
    @RequestMapping(value = "/take/batch", method = RequestMethod.POST)
    public Wrapper<Void> batchTakeOrders(@RequestHeader HttpHeaders headers, @RequestBody @Valid List<OrderIdVO> orderIds) {
        return buyerOrderService.batchTakeOrders(headers, orderIds);
    }

    /**
     * （订单查询页面）获取前端页面下拉框列表
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/page/items", method = RequestMethod.GET)
    public Wrapper<PageItemVO> getPageItems(@RequestHeader HttpHeaders headers) {
        return buyerOrderService.getPageItems(headers);
    }

    /**
     * 分页查询订单
     * @param headers Http头部信息
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @BuyerAuth
    @RequestMapping(value = "/page", method = RequestMethod.GET)
    public Wrapper<PageData<BuyerOrderQueryVO>> pageOrders(@RequestHeader HttpHeaders headers, @Valid OrderManagePageVO pageVO) {
        return buyerOrderService.pageOrders(headers, pageVO);
    }

    /**
     * 订单退款
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 退款结果
     */
    @RequestMapping(value = "/refund", method = RequestMethod.POST)
    public Wrapper<Void> orderRefund(@RequestHeader HttpHeaders headers, @RequestBody @Valid OrderIdVO idVO) {
        return buyerOrderService.orderRefund(headers, idVO);
    }

    /**
     * 分页查询订单 - 订单删除
     * @param headers Http头部信息
     * @param idVO    接口参数
     * @return 操作结果
     */
    @RequestMapping(value = "/page/delete", method = RequestMethod.POST)
    public Wrapper<Void> pageOrderDelete(@RequestHeader HttpHeaders headers, @RequestBody @Valid OrderIdVO idVO) {
        return buyerOrderService.pageOrderDelete(headers, idVO);
    }

    /**
     * 订单详情
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/detail", method = RequestMethod.GET)
    public Wrapper<BuyerOrderDetailVO> getOrderDetail(@RequestHeader HttpHeaders headers, @Valid OrderIdVO idVO) {
        return buyerOrderService.getOrderDetail(headers, idVO);
    }

    /**
     * 采购订单详情 - 申请开票
     * @param headers Http头部信息
     * @param invoiceVO 接口参数
     * @return 操作结果
     */
    @RequestMapping(value = "/invoice", method = RequestMethod.POST)
    public Wrapper<Void> applyInvoice(@RequestHeader HttpHeaders headers, @RequestBody @Valid BuyerApplyInvoiceVO invoiceVO) {
        return buyerOrderService.applyInvoice(headers, invoiceVO);
    }

    /**
     * 取消订单
     * @param headers Http头部信息
     * @param reasonVO 接口参数
     * @return 操作结果
     */
    @RequestMapping(value = "/cancel", method = RequestMethod.POST)
    public Wrapper<Void> cancelOrder(@RequestHeader HttpHeaders headers, @RequestBody @Valid OrderReasonVO reasonVO) {
        return buyerOrderService.cancelOrder(headers, reasonVO);
    }

    /**
     * 订单查询导出
     * @param token 登录token
     * @param pageVO 接口参数
     * @param response 响应体
     */
    @RequestMapping(value = "/export", method = RequestMethod.GET)
    public void exportOrders(HttpServletResponse response, @Valid OrderManagePageVO pageVO, String token) {
        buyerOrderService.exportOrders(response, pageVO, token);
    }

    /**
     * 根据供应商会员信息和商城id获取预约时长和配置配送时间段
     * @param headers HttpHeaders信息
     * @param deliveryDateVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/find/delivery/date", method = RequestMethod.GET)
    public Wrapper<OrderDeliveryDateVO> findDeliveryDate(@RequestHeader HttpHeaders headers, @Valid DeliveryDateVO deliveryDateVO) {
        return buyerOrderService.findBuyerDeliveryDate(headers, deliveryDateVO);
    }

    /**
     * 查看订单送货时间
     * @param headers Http头部信息
     * @param timeVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/get/delivery/time", method = RequestMethod.GET)
    public Wrapper<OrderDeliverTimeDetailVO> getDeliveryTime(@RequestHeader HttpHeaders headers, @Valid BuyerOrderDeliveryTimeVO timeVO) {
        return buyerOrderService.getDeliveryTime(headers, timeVO);
    }

    /**
     * 未发货调整订单送货时间
     * @param headers Http头部信息
     * @param updateVO 接口参数
     * @return 操作结果
     */
    @RequestMapping(value = "/update/delivery/time", method = RequestMethod.POST)
    public Wrapper<Void> updateDeliveryTime(@RequestHeader HttpHeaders headers, @RequestBody @Valid BuyerOrderDeliveryTimeUpdateVO updateVO) {
        return buyerOrderService.updateDeliveryTime(headers, updateVO);
    }

    /**
     * “待新增订单” - 获取前端页面下拉框列表
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/create/page/items", method = RequestMethod.GET)
    public Wrapper<BuyerToCreatePageItemVO> getToCreatePageItems(@RequestHeader HttpHeaders headers) {
        return buyerOrderService.getToCreatePageItems(headers);
    }

    /**
     * “待新增订单” - 分页查询订单列表
     * @param headers Http头部信息
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @BuyerAuth
    @RequestMapping(value = "/create/page", method = RequestMethod.GET)
    public Wrapper<PageData<BuyerToCreateQueryVO>> pageToCreateOrders(@RequestHeader HttpHeaders headers, @Valid OrderPageVO pageVO) {
        return buyerOrderService.pageToCreateOrders(headers, pageVO);
    }

    /**
     * “新增订单” - “通用” - 查询订单详情
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/create/detail", method = RequestMethod.GET)
    public Wrapper<BuyerOrderDetailVO> getToCreateOrderDetails(@RequestHeader HttpHeaders headers, @Valid OrderIdVO idVO) {
        return buyerOrderService.getToCreateOrderDetails(headers, idVO);
    }

    /**
     * “待新增订单” - 创建SRM订单
     * @param headers Http头部信息
     * @param orderVO 接口参数
     * @return 创建结果
     */
    @RequestMapping(value = "/create/srm", method = RequestMethod.POST)
    public Wrapper<Void> createSrmOrder(@RequestHeader HttpHeaders headers, @RequestBody @Valid BuyerSrmOrderVO orderVO) {
        return buyerOrderService.createSrmOrder(headers, orderVO);
    }

    /**
     * “待新增订单” - 修改Srm订单
     * @param headers Http头部信息
     * @param updateVO 接口参数
     * @return 修改结果
     */
    @RequestMapping(value = "/create/srm/update", method = RequestMethod.POST)
    public Wrapper<Void> updateSrmOrder(@RequestHeader HttpHeaders headers, @RequestBody @Valid BuyerSrmOrderUpdateVO updateVO) {
        return buyerOrderService.updateSrmOrder(headers, updateVO);
    }

    /**
     * “新增订单” - 分页查询SRM订单列表
     * @param headers Http头部信息
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @BuyerAuth
    @RequestMapping(value = "/create/srm/page", method = RequestMethod.GET)
    public Wrapper<PageData<BuyerToCreateQueryVO>> pageSrmOrders(@RequestHeader HttpHeaders headers, @Valid OrderPageVO pageVO) {
        return buyerOrderService.pageSrmOrders(headers, pageVO);
    }

    /**
     * “新增订单” - 通用 - 查询支付环节列表
     * @param headers Http头部信息
     * @param payVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/create/payment/find", method = RequestMethod.POST)
    public Wrapper<List<BuyerOrderPayNodeDetailVO>> findBusinessOrderProcessPayment(@RequestHeader HttpHeaders headers, @RequestBody @Valid OrderProcessPayVO payVO) {
        return buyerOrderService.findBusinessOrderProcessPayment(headers, payVO);
    }

    /**
     * “新增订单” - “修改订单” - “通用” - 查询支付环节列表
     * @param headers Http头部信息
     * @param updateVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/create/update/payment/find", method = RequestMethod.GET)
    public Wrapper<List<BuyerOrderPayNodeQueryVO>> findBusinessOrderProcessPaymentUpdate(@RequestHeader HttpHeaders headers, @Valid BuyerBusinessOrderProcessPayUpdateVO updateVO) {
        return buyerOrderService.findBusinessOrderProcessPaymentUpdate(headers, updateVO);
    }

    /**
     * “新增订单” - 通用 - 查询支付方式与支付渠道列表
     * @param headers Http头部信息
     * @param vendorMemberVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/create/pay/types", method = RequestMethod.GET)
    public Wrapper<List<OrderPayTypeDetailVO>> findBusinessOrderPayTypes(@RequestHeader HttpHeaders headers, @Valid OrderVendorMemberVO vendorMemberVO) {
        return buyerOrderService.findBusinessOrderPayTypes(headers, vendorMemberVO);
    }

    /**
     * “待新增订单” - 创建B2B订单
     * @param headers Http头部信息
     * @param orderVO 接口参数
     * @return 创建结果
     */
    @RequestMapping(value = "/create/b2b", method = RequestMethod.POST)
    public Wrapper<Void> createBusinessOrder(@RequestHeader HttpHeaders headers, @RequestBody @Valid BuyerBusinessOrderVO orderVO) {
        return buyerOrderService.createBusinessOrder(headers, orderVO);
    }

    /**
     * “待新增订单” - 修改B2B订单
     * @param headers Http头部信息
     * @param updateVO 接口参数
     * @return 创建结果
     */
    @RequestMapping(value = "/create/b2b/update", method = RequestMethod.POST)
    public Wrapper<Void> updateBusinessOrder(@RequestHeader HttpHeaders headers, @RequestBody @Valid BuyerBusinessOrderUpdateVO updateVO) {
        return buyerOrderService.updateBusinessOrder(headers, updateVO);
    }

    /**
     * “新增现货采购订单” - 分页查询现货采购订单列表
     * @param headers Http头部信息
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @BuyerAuth
    @RequestMapping(value = "/create/purchase/page", method = RequestMethod.GET)
    public Wrapper<PageData<BuyerToCreateQueryVO>> pagePurchaseOrders(@RequestHeader HttpHeaders headers, @Valid BuyerOrderCreatePageVO pageVO) {
        return buyerOrderService.pagePurchaseOrders(headers, pageVO);
    }

    /**
     * “新增现货采购订单” - 根据商城类型查询订单类型和订单模式
     * @param headers Http头部信息
     * @param shopTypeVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/create/purchase/types", method = RequestMethod.GET)
    public Wrapper<OrderModeVO> findPurchaseOrderTypes(@RequestHeader HttpHeaders headers, @Valid PurchaseOrderShopTypeVO shopTypeVO) {
        return buyerOrderService.findPurchaseOrderTypes(headers, shopTypeVO);
    }

    /**
     * “新增现货采购订单” - 创建现货采购订单
     * @param headers Http头部信息
     * @param orderVO 接口参数
     * @return 新增结果
     */
    @RequestMapping(value = "/create/purchase", method = RequestMethod.POST)
    public Wrapper<Void> createPurchaseOrder(@RequestHeader HttpHeaders headers, @RequestBody @Valid BuyerPurchaseOrderVO orderVO) {
        return buyerOrderService.createPurchaseOrder(headers, orderVO);
    }

    /**
     * “新增现货采购订单” - 修改现货采购订单
     * @param headers Http头部信息
     * @param updateVO 接口参数
     * @return 新增结果
     */
    @RequestMapping(value = "/create/purchase/update", method = RequestMethod.POST)
    public Wrapper<Void> updatePurchaseOrder(@RequestHeader HttpHeaders headers, @RequestBody @Valid BuyerPurchaseOrderUpdateVO updateVO) {
        return buyerOrderService.updatePurchaseOrder(headers, updateVO);
    }

    /**
     * 请购单订单 - 新增订单
     * @param headers Http头部信息
     * @param orderVO 接口参数
     * @return 新增结果
     */
    @RequestMapping(value = "/create/requisition", method = RequestMethod.POST)
    public Wrapper<Void> createRequisitionOrder(@RequestHeader HttpHeaders headers, @RequestBody @Valid RequisitionOrderCreateVO orderVO) {
        return buyerOrderService.createRequisitionOrder(headers, orderVO);
    }

    /**
     * 请购单订单 - 修改订单
     * @param headers Http头部信息
     * @param orderVO 接口参数
     * @return 操作结果
     */
    @RequestMapping(value = "/update/requisition", method = RequestMethod.POST)
    public Wrapper<Void> updateRequisitionOrder(@RequestHeader HttpHeaders headers, @RequestBody @Valid RequisitionOrderUpdateVO orderVO) {
        return buyerOrderService.updateRequisitionOrder(headers, orderVO);
    }

    /**
     * 新增请购单订单 - 分页查询待新增订单
     * @param headers Http头部信息
     * @param pageVO 接口参数
     * @return 新增结果
     */
    @BuyerAuth
    @RequestMapping(value = "/create/requisition/page", method = RequestMethod.GET)
    public Wrapper<PageData<BuyerToCreateQueryVO>> createRequisitionPage(@RequestHeader HttpHeaders headers, @Valid BuyerOrderCreatePageVO pageVO) {
        return buyerOrderService.createRequisitionPage(headers, pageVO);
    }

    /**
     * “新增订单” - “通用” - 删除订单
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 删除结果
     */
    @RequestMapping(value = "/create/delete", method = RequestMethod.POST)
    public Wrapper<Void> deleteOrder(@RequestHeader HttpHeaders headers, @RequestBody @Valid OrderIdVO idVO) {
        return buyerOrderService.deleteOrder(headers, idVO);
    }

    /**
     * “新增订单” - “通用” - 批量删除订单
     * @param headers Http头部信息
     * @param orderIds 接口参数
     * @return 删除结果
     */
    @RequestMapping(value = "/create/delete/batch", method = RequestMethod.POST)
    public Wrapper<Void> batchDeleteOrder(@RequestHeader HttpHeaders headers, @RequestBody @Valid List<OrderIdVO> orderIds) {
        return buyerOrderService.batchDeleteOrder(headers, orderIds);
    }

    /**
     * “新增订单” - “通用” - 提交
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 删除结果
     */
    @RequestMapping(value = "/create/submit", method = RequestMethod.POST)
    public Wrapper<Void> submitOrder(@RequestHeader HttpHeaders headers, @RequestBody @Valid OrderIdVO idVO) {
        return buyerOrderService.submitOrder(headers, idVO);
    }

    /**
     * “新增订单” - “通用” - 批量提交
     * @param headers Http头部信息
     * @param orderIds 接口参数
     * @return 删除结果
     */
    @RequestMapping(value = "/create/submit/batch", method = RequestMethod.POST)
    public Wrapper<Void> batchSubmitOrder(@RequestHeader HttpHeaders headers, @RequestBody @Valid List<OrderIdVO> orderIds) {
        return buyerOrderService.batchSubmitOrder(headers, orderIds);
    }

    /**
     * （订单审核各个页面）获取前端页面下拉框列表
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/validate/page/items", method = RequestMethod.GET)
    public Wrapper<ValidatePageItemVO> getValidatePageItems(@RequestHeader HttpHeaders headers) {
        return buyerOrderService.getValidatePageItems(headers);
    }

    /**
     * “待审核订单（一级）” - 分页查询订单列表
     * @param headers Http头部信息
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @BuyerAuth
    @RequestMapping(value = "/validate/grade/one/page", method = RequestMethod.GET)
    public Wrapper<PageData<OrderPageQueryVO>> pageToValidateGradeOneOrders(@RequestHeader HttpHeaders headers, @Valid OrderPageVO pageVO) {
        return buyerOrderService.pageToValidateGradeOneOrders(headers, pageVO);
    }

    /**
     * “待审核订单（一级）” - 查询订单详情
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/validate/grade/one/detail", method = RequestMethod.GET)
    public Wrapper<BuyerOrderDetailVO> getToValidateGradeOneOrderDetails(@RequestHeader HttpHeaders headers, @Valid OrderIdVO idVO) {
        return buyerOrderService.getToValidateGradeOneOrderDetails(headers, idVO);
    }

    /**
     * “待审核订单（一级）” - 审核
     * @param headers Http头部信息
     * @param agreeVO 接口参数
     * @return 审核结果
     */
    @RequestMapping(value = "/validate/grade/one", method = RequestMethod.POST)
    public Wrapper<Void> validateOrderGradeOne(@RequestHeader HttpHeaders headers, @RequestBody @Valid OrderAgreeVO agreeVO) {
        return buyerOrderService.validateOrderGradeOne(headers, agreeVO);
    }

    /**
     * “待审核订单（一级）” - 批量审核
     * @param headers Http头部信息
     * @param orderIds 接口参数
     * @return 审核结果
     */
    @RequestMapping(value = "/validate/grade/one/batch", method = RequestMethod.POST)
    public Wrapper<Void> batchValidateOrdersGradeOne(@RequestHeader HttpHeaders headers, @RequestBody @Valid List<OrderIdVO> orderIds) {
        return buyerOrderService.batchValidateOrdersGradeOne(headers, orderIds);
    }

    /**
     * “待审核订单（二级）” - 分页查询订单列表
     * @param headers Http头部信息
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @BuyerAuth
    @RequestMapping(value = "/validate/grade/two/page", method = RequestMethod.GET)
    public Wrapper<PageData<OrderPageQueryVO>> pageToValidateGradeTwoOrders(@RequestHeader HttpHeaders headers, @Valid OrderPageVO pageVO) {
        return buyerOrderService.pageToValidateGradeTwoOrders(headers, pageVO);
    }

    /**
     * “待审核订单（二级）” - 查询订单详情
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/validate/grade/two/detail", method = RequestMethod.GET)
    public Wrapper<BuyerOrderDetailVO> getToValidateGradeTwoOrderDetails(@RequestHeader HttpHeaders headers, @Valid OrderIdVO idVO) {
        return buyerOrderService.getToValidateGradeTwoOrderDetails(headers, idVO);
    }

    /**
     * “待审核订单（二级）” - 审核
     * @param headers Http头部信息
     * @param agreeVO 接口参数
     * @return 审核结果
     */
    @RequestMapping(value = "/validate/grade/two", method = RequestMethod.POST)
    public Wrapper<Void> validateOrderGradeTwo(@RequestHeader HttpHeaders headers, @RequestBody @Valid OrderAgreeVO agreeVO) {
        return buyerOrderService.validateOrderGradeTwo(headers, agreeVO);
    }

    /**
     * “待审核订单（二级）” - 批量审核
     * @param headers Http头部信息
     * @param orderIds 接口参数
     * @return 审核结果
     */
    @RequestMapping(value = "/validate/grade/two/batch", method = RequestMethod.POST)
    public Wrapper<Void> batchValidateOrdersGradeTwo(@RequestHeader HttpHeaders headers, @RequestBody @Valid List<OrderIdVO> orderIds) {
        return buyerOrderService.batchValidateOrdersGradeTwo(headers, orderIds);
    }

    /**
     * “待提交订单” - 分页查询订单列表
     * @param headers Http头部信息
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @BuyerAuth
    @RequestMapping(value = "/validate/submit/page", method = RequestMethod.GET)
    public Wrapper<PageData<OrderPageQueryVO>> pageToSubmitOrders(@RequestHeader HttpHeaders headers, @Valid OrderPageVO pageVO) {
        return buyerOrderService.pageToSubmitOrders(headers, pageVO);
    }

    /**
     * “待提交订单” - 查询订单详情
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/validate/submit/detail", method = RequestMethod.GET)
    public Wrapper<BuyerOrderDetailVO> getToSubmitOrderDetails(@RequestHeader HttpHeaders headers, @Valid OrderIdVO idVO) {
        return buyerOrderService.getToSubmitOrderDetails(headers, idVO);
    }

    /**
     * “待提交订单” - 提交
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 审核结果
     */
    @RequestMapping(value = "/validate/submit", method = RequestMethod.POST)
    public Wrapper<Void> submitValidateOrder(@RequestHeader HttpHeaders headers, @RequestBody @Valid OrderIdVO idVO) {
        return buyerOrderService.submitValidateOrder(headers, idVO);
    }

    /**
     * “待提交订单” - 批量提交
     * @param headers Http头部信息
     * @param orderIds 接口参数
     * @return 审核结果
     */
    @RequestMapping(value = "/validate/submit/batch", method = RequestMethod.POST)
    public Wrapper<Void> batchSubmitValidateOrders(@RequestHeader HttpHeaders headers, @RequestBody @Valid List<OrderIdVO> orderIds) {
        return buyerOrderService.batchSubmitValidateOrders(headers, orderIds);
    }

    /**
     * “待支付订单” - 查询订单列表
     * @param headers Http头部信息
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @BuyerAuth
    @RequestMapping(value = "/validate/pay/page", method = RequestMethod.GET)
    public Wrapper<PageData<BuyerToPayQueryVO>> pageToPayOrders(@RequestHeader HttpHeaders headers, @Valid OrderValidatePageVO pageVO) {
        return buyerOrderService.pageToPayOrders(headers, pageVO);
    }

    /**
     * “待支付订单” - 查询订单详情
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/validate/pay/detail", method = RequestMethod.GET)
    public Wrapper<BuyerOrderDetailVO> getToPayOrderDetails(@RequestHeader HttpHeaders headers, @Valid OrderIdVO idVO) {
        return buyerOrderService.getToPayOrderDetails(headers, idVO);
    }

    /**
     * “待支付订单” - 订单详情 - 查询支付方式与支付渠道列表
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/validate/pay/type", method = RequestMethod.GET)
    public Wrapper<List<OrderPayTypeDetailVO>> getToPayOrderPayTypes(@RequestHeader HttpHeaders headers, @Valid OrderIdVO idVO) {
        return buyerOrderService.getToPayOrderPayTypes(headers, idVO);
    }

    /**
     * “待支付订单” - 订单支付
     * @param headers HttpHeader信息
     * @param payVO 接口参数
     * @return 支付链接（在线支付）
     */
    @RequestMapping(value = "/validate/pay", method = RequestMethod.POST)
    public Wrapper<PayResultDetailVO> orderPay(@RequestHeader HttpHeaders headers, @RequestBody @Valid BuyerOrderPayVO payVO) {
        return buyerOrderService.orderPay(headers, payVO);
    }

    /**
     * “待支付订单” - 查询支付结果
     * @param headers HttpHeader信息
     * @param resultVO 接口参数
     * @return 支付结果
     */
    @RequestMapping(value = "/validate/pay/result", method = RequestMethod.GET)
    public Wrapper<BuyerPayResultDetailVO> findPayResult(@RequestHeader HttpHeaders headers, @Valid BuyerPayResultVO resultVO) {
        return buyerOrderService.findPayResult(headers, resultVO);
    }

    /**
     * “待发货订单” - 查询订单列表
     * @param headers Http头部信息
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @BuyerAuth
    @RequestMapping(value = "/validate/delivery/page", method = RequestMethod.GET)
    public Wrapper<PageData<BuyerToDeliveryQueryVO>> pageToDeliveryOrders(@RequestHeader HttpHeaders headers, @Valid OrderValidatePageVO pageVO) {
        return buyerOrderService.pageToDeliveryOrders(headers, pageVO);
    }

    /**
     * “待发货订单” - 订单详情 - 邀请好友拼团 - 生成小程序码分享链接
     * @param headers Http头部信息
     * @param idVO    接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/delivery/mini/app/code", method = RequestMethod.GET)
    public Wrapper<String> createDeliveryMiniAppCode(@RequestHeader HttpHeaders headers, @Valid OrderIdVO idVO) {
        return buyerOrderService.createDeliveryMiniAppCode(headers, idVO);
    }

    /**
     * “待新增采购收货单” - 查询订单列表
     * @param headers Http头部信息
     * @param pageVO  接口参数
     * @return 查询结果
     */
    @BuyerAuth
    @RequestMapping(value = "/create/receive/page", method = RequestMethod.GET)
    public Wrapper<PageData<BuyerOrderReceiveQueryVO>> pageCreateReceiveOrders(@RequestHeader HttpHeaders headers, @Valid BuyerOrderReceivePageVO pageVO) {
        return buyerOrderService.pageCreateReceiveOrders(headers, pageVO);
    }

    /**
     * “待新增采购收货单” - 创建收货单
     * @param headers Http头部信息
     * @param orderVO 接口参数
     * @return 操作结果
     */
    @RequestMapping(value = "/create/receive", method = RequestMethod.POST)
    public Wrapper<Void> createReceiveOrder(@RequestHeader HttpHeaders headers, @RequestBody @Valid BuyerCreateReceiveVO orderVO) {
        return buyerOrderService.createReceiveOrder(headers, orderVO);
    }

    /**
     * “待新增采购收货单” - 查看详情
     * @param headers Http头部信息
     * @param idVO    接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/receive/detail", method = RequestMethod.GET)
    public Wrapper<BuyerReceiveDetailVO> getReceiveDetail(@RequestHeader HttpHeaders headers, @Valid OrderIdVO idVO) {
        return buyerOrderService.getReceiveDetail(headers, idVO);
    }

    /**
     * “待新增采购收货单” - 审核采购收货单
     * @param headers Http头部信息
     * @param idVO    接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/validate/receive", method = RequestMethod.POST)
    public Wrapper<Void> validateToReceiveOrder(@RequestHeader HttpHeaders headers, @RequestBody @Valid OrderIdVO idVO) {
        return buyerOrderService.validateToReceiveOrder(headers, idVO);
    }

    /**
     * “待确认收货订单” -查询订单列表
     * @param headers Http头部信息
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @BuyerAuth
    @RequestMapping(value = "/validate/receive/page", method = RequestMethod.GET)
    public Wrapper<PageData<BuyerReceiveQueryVO>> pageToReceiveOrders(@RequestHeader HttpHeaders headers, @Valid OrderValidatePageVO pageVO) {
        return buyerOrderService.pageToReceiveOrders(headers, pageVO);
    }

    /**
     * “待确认收货订单” -查询订单详情
     * @param headers Http头部信息
     * @param idVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/validate/receive/detail", method = RequestMethod.GET)
    public Wrapper<BuyerOrderDetailVO> getToReceiveOrderDetails(@RequestHeader HttpHeaders headers, @Valid OrderIdVO idVO) {
        return buyerOrderService.getToReceiveOrderDetails(headers, idVO);
    }

    /**
     * “待确认收货订单” - 确认收货
     * @param headers Http头部信息
     * @param receiveVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/validate/receive/confirm", method = RequestMethod.POST)
    public Wrapper<Void> receiveOrder(@RequestHeader HttpHeaders headers, @RequestBody @Valid BuyerReceiveVO receiveVO) {
        return buyerOrderService.receiveOrder(headers, receiveVO);
    }

    /**
     * 订单分页查询 - 通用 - 所有订单类型下拉框列表
     * @return 查询结果
     */
    @RequestMapping(value = "/order/type/all", method = RequestMethod.GET)
    public Wrapper<List<DropdownItem>> getAllOrderType() {
        return buyerOrderService.getAllOrderType();
    }

    /**
     * 提交订单 - 查询满额包邮的商品总运费
     * @param headers   HttpHeaders信息
     * @param freightVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/product/free/freight", method = RequestMethod.POST)
    public Wrapper<BigDecimal> findProductFreeFreight(@RequestHeader HttpHeaders headers, @RequestBody @Valid OrderProductFreeFreightVO freightVO) {
        return buyerOrderService.findProductFreeFreight(headers, freightVO);
    }
}
